package com.zr.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletResponseAware;
import org.springframework.stereotype.Controller;

import com.zr.service.UpdatePriceService;
@Controller
public class UpdatePriceAction implements ServletResponseAware{
	private Integer tpid;
	private Double tprice;
	private Double fkgc;
	private Double subkilogramme;
	private Double mtm;
	private HttpServletResponse resp;
	
	public Integer getTpid() {
		return tpid;
	}

	public void setTpid(Integer tpid) {
		this.tpid = tpid;
	}

	public Double getTprice() {
		return tprice;
	}

	public void setTprice(Double tprice) {
		this.tprice = tprice;
	}

	public Double getFkgc() {
		return fkgc;
	}

	public void setFkgc(Double fkgc) {
		this.fkgc = fkgc;
	}

	public Double getSubkilogramme() {
		return subkilogramme;
	}

	public void setSubkilogramme(Double subkilogramme) {
		this.subkilogramme = subkilogramme;
	}

	public Double getMtm() {
		return mtm;
	}

	public void setMtm(Double mtm) {
		this.mtm = mtm;
	}

	@Override
	public void setServletResponse(HttpServletResponse arg0) {
		// TODO Auto-generated method stub
		this.resp=arg0;
	}
	@Resource
	private UpdatePriceService upprseim;
	String sta="待审核";
	public void updatePrice(){
		resp.setCharacterEncoding("utf8");
		try {
			PrintWriter pw=resp.getWriter();
			upprseim.updatePrice(tpid, tprice, fkgc, subkilogramme, mtm, sta);
			pw.write("1");
			pw.flush();
			pw.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
